Compilation of Effect Handlers and their Applications in Concurrency
نویسندگان
چکیده
Algebraic effects combined with effect handlers have emerged as compelling, modular abstraction for modelling and controlling computational effects. By separating the effect signatures from their implementation, algebraic effects afford a high degree of modularity as programmers can describe effectful computations independently of their concrete interpretation. We present a compiler for the functional programming language Links that uses the Multicore OCaml backend to provide a native implementation of effect handlers. We present a core calculus λρeff with row-polymorphic effects and effect handlers based on a variation of A-normal form used in our implementation. In addition, we give an operational semantics for the calculus. Furthermore, we describe a translation from λρeff to a subset of the intermediate language used by OCaml. Interestingly, concurrency can be described as an algebraic effect, whose handler amounts to a scheduler. Thus, rather than baking concurrency support into the compiler, we keep the compiler lean by implementing the message-passing concurrency model of Links using handlers. We demonstrate a faithful encoding of the concurrency model, which maintains type-safe communication by taking advantage of the effect system of Links. Finally, we perform some experiments with the compiler using the concurrency implementation to see how it performs against the Links interpreter. Moreover, we consider how to improve the performance of the compiler.
منابع مشابه
A Survey of Concurrency Control Algorithms in the Operating Systems
Concurrency control is one of the important problems in operation systems. Various studies have been reported to present different algorithms to address this problem, although a few attempts have been made to represent an overall view of the characteristics of these algorithms and comparison of their capabilities to each other. This paper presents a survey of the current methods for controlling...
متن کاملReactive Context-Aware Programming
Using state of the art tools, context-aware applications are notified of relevant changes in their environment through event handlers which are triggered by dedicated middleware. The events signalled by the middleware should percolate through the entire application, requiring a carefully crafted network of observers combined with complex synchronization code to address the inherent concurrency ...
متن کاملA Survey of Concurrency Control Algorithms in the Operating Systems
Concurrency control is one of the important problems in operation systems. Various studies have been reported to present different algorithms to address this problem, although a few attempts have been made to represent an overall view of the characteristics of these algorithms and comparison of their capabilities to each other. This paper presents a survey of the current methods for controlling...
متن کاملVisualizing Data Races in Concurrent Signal Handlers
Asynchronous signal handling introduces fine-grained concurrency into sequential programs making them prone to data races. Unfortunately, existing tools for detecting data races in sequential programs that use concurrent signal handlers fail to provide effective means for understanding the dynamic behavior of concurrent signal handlers involved in data races. Thus, this paper presents a visuali...
متن کاملToward a modular and efficient distribution for Web service handlers
Over the last few decades, distributed systems have demonstrated architectural evolvement. One recent evolutionary step is Service-Oriented Architecture (SOA). The SOA model is perfectly engendered in Web services, which provide software platforms to build applications as services. Web services utilize supportive capabilities such as security, reliability, and monitoring. These capabilities are...
متن کامل